#ifndef MOVING_ENTITY_H
#define MOVING_ENTITY_H


#include "Message.h"
#include "BaseGameEntity.h"
#include "PathPlanner.h"



class SteeringBehavior;
class MovingEntity : public BaseGameEntity
{

protected:

	Vector2D velocity;
	double maxSpeed;
	int accel;
	SteeringBehavior* m_pSteeringBehavior;
	PathPlanner* m_pPlanner;

public:

	MovingEntity();
	MovingEntity(string name, Vector2D pos, int type);
	virtual ~MovingEntity();


	double GetMaxSpeed() {return maxSpeed;}
	int GetAccel() {return accel;}

	Vector2D Heading() {return Vec2DNormalize(velocity);}
	Vector2D Side() {return Vec2DNormalize(velocity.Perp());}

	Vector2D GetVelocity() const {return velocity;}
	int GetSpeed() {return int(velocity.Length());}

	void Stop() {velocity.Normalize();} // Velocities of a length of under one are considered to be zero
	void AddForce(Vector2D force) {velocity += force;}

	bool CanMoveBetween(Vector2D Start, Vector2D Finish); 

	virtual bool HandleMessage(const Message& msg) {return true;}	
	virtual void Update(double time_elapsed);
	virtual void Render();


	void SetBehaviorTarget(Vector2D pos); 

};

#endif